<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html lang="en">
<head>
	<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp">
	<title>登录</title>
	<link rel="stylesheet" href="${ctx}/static/css/mdui.css">
  <style>
    body {
      height: 100%;
    }
    .mdui-valign {
      height: 300px;
      width: 100%;
    }
    h1 {
      color: #fff;
      width: 100%;
    }
    .logo-img img{
      display: block;
      width: 50%;
    }
  </style>
</head>
<body class="mdui-appbar-with-toolbar mdui-theme-primary-blue mdui-theme-accent-pink mdui-loaded docs-theme-primary body-login">
<header class="mdui-appbar mdui-appbar-fixed">
  <div class="mdui-toolbar mdui-color-theme">
    <span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-drawer="{target: '#main-drawer', swipe: true}"><i class="mdui-icon material-icons">assistant_photo</i></span>
    <a href="javascript:;" class="mdui-typo-headline mdui-hidden-xs">员工培训系统</a>
    <div class="mdui-toolbar-spacer"></div>
    <span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-dialog="{target: '#dialog-docs-theme'}" mdui-tooltip="{content: '设置主题'}"><i class="mdui-icon material-icons">color_lens</i></span>
  </div>
</header>
<div class="mdui-col-sm-6 mdui-col-md-4 mdui-col-offset-md-4 mdui-col-offset-sm-3 login-wrapper mdui-p-y-4">
  <h1 class="mdui-text-center">某某某集团员工培训系统</h1>
  <div class="mdui-card mdui-m-b-4">
    <div class="logo-img mdui-p-y-3">
      <img class="mdui-center mdui-img-rounded" src="${ctx}/static/img/card.jpg"/>
    </div>
    <div class="mdui-card-content form-login">
      <!-- 浮动标签、多行文本框 -->
      <div class="mdui-textfield mdui-textfield-floating-label">
        <i class="mdui-icon material-icons">account_box</i>
        <label class="mdui-textfield-label">员工号</label>
        <input id="sta_id" name="sta_id"class="mdui-textfield-input">
      </div>
      <!-- 浮动标签、多行文本框 -->
      <div class="mdui-textfield mdui-textfield-floating-label">
        <i class="mdui-icon material-icons">lock_outline</i>
        <label class="mdui-textfield-label">密码</label>
        <input id="sta_password" name="sta_password" class="mdui-textfield-input" type="password">
      </div>
      <!-- 浮动标签、多行文本框 -->
      <div class="mdui-clearfix">
        <div class="mdui-textfield mdui-textfield-floating-label mdui-col-xs-6">
          <i class="mdui-icon material-icons">textsms</i>
          <label class="mdui-textfield-label">验证码</label>
          <input id="randomCode" name="randomCode" class="mdui-textfield-input">
        </div>
        <div class="mdui-textfield mdui-textfield-floating-label mdui-col-xs-6 mdui-float-right mdui-typo">
          <img src="${ctx}/individual/captcha"  onclick="this.src='${ctx}/individual/captcha?x='+Math.random()"class="mdui-col-xs-6 mdui-ripple"style="display: block;height: 40px;margin-top: 20px;">
         <!--  <a href="javascript:;" class="mdui-float-right" style="margin-top: 10px;">看不清楚？</br> 点击更换</a> -->
        </div>
      </div>
      <div class="mdui-textfield mdui-textfield-floating-label">
        <label class="mdui-radio" style="margin-left: 56px;">
          <input type="radio" id="group1" name="group1"value="0" checked/>
          <i class="mdui-radio-icon"></i>
          学员
        </label>
        <label class="mdui-radio">
          <input type="radio" id="group1" name="group1" value="1"/>
          <i class="mdui-radio-icon"></i>
          教师
        </label>
        <label class="mdui-radio">
          <input type="radio" id="group1" name="group1"  value="2"/>
          <i class="mdui-radio-icon"></i>
          管理员
        </label>
      </div>
      <div class="mdui-textfield mdui-textfield-floating-label">
        <button class="mdui-col-xs-6 mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent " onclick="login()">登录</button>
        <button class="mdui-col-xs-5 mdui-float-right mdui-btn mdui-btn-raised mdui-ripple" style="margin-right: 1px;">重置</button>
      </div>
      <div class="mdui-textfield mdui-textfield-floating-label mdui-typo">
        <p class="mdui-text-center"><a href="./forgetPassword-1.html">忘记密码？</a></p>
      </div>
      
    </div>
  </div>
</div>
<%@include file="../common/theme.jsp"%>


<script src="${ctx}/static/js/mdui.min.js"></script>
<script>var $$ = mdui.JQ;</script>
<script src="${ctx}/static/js/highlight.pack.js"></script>
<script src="${ctx}/static/js/smooth-scroll.min.js"></script>
<script src="${ctx}/static/js/holder.min.js"></script>
<script src="${ctx}/static/js/base.js"></script>
<script src="${ctx}/static/js/jquery-1.7.min.js"></script>


<script>
function login(){
var uid=$("#sta_id").val();
var password=$("#sta_password").val();
var group1=$("#group1").val();
var randomCode=$("#randomCode").val();
if(uid==""||uid.length==0)
	{
	 $("#submitBtn").attr("onclick","login(this)");
     return false; 
     }
     else if(password==""||password.length==0)
     {
     $("#submitBtn").attr("onclick","login(this)");
     return false; 
     }
     else if(group1==""|| group1.length==0)
     {
     	$("#submitBtn").attr("onclick","login(this)");
     return false; 
     }
 $.ajax({
         		type: "post",
    			dataType: 'json',
				data: {uid:uid,password:password,group1:group1,randomCode:randomCode
					
				},
				url:"individual/login",
				success:function(data){
				
				  var tempSta = data.status; //用户已存在  
				 if(tempSta=="0"){
                    /* document.getElementById("sta_id").innerHTML="用户不存";   */
                    	alert("账户不存在！");
					$("#submitBtn").attr("onclick","login(this)");
     				return false; 
				 }
				 if(tempSta=="1"){
				 alert("员工的1");
				  window.location.href="${ctx}/individual/userInfo"; 
				 }
				 if(tempSta=="2"){
				 	/*  document.getElementById("sta_password").innerHTML="密码错误";   */
				 	alert("密码错误！");
				 	 $("#submitBtn").attr("onclick","login(this)");
     				return false; 
				 }
				 if(tempSta=="3"){
				 alert("用户的类型与身份不符！");
				 $("#submitBtn").attr("onclick","login(this)");
     			return false; 
				 }
				 if(tempSta=="4"){
				 alert("验证码不正确！");
				 $("#submitBtn").attr("onclick","login(this)");
     			return false; 
				 }  
				}
			});


}
  $$(function () {

  
  });
</script>
</body>
</html>